package com.atguigu.gulimall.order.listener;

import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.stereotype.Component;

/**
 * @Author guojian.Yu
 * @Date 2022/7/1 11:39
 * @Description:
 */
@Component
public class RedisKeyExpirationListener extends KeyExpirationEventMessageListener {
    /**
     *
     *
     * @param listenerContainer must not be {@literal null}.
     */
    public RedisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
        super(listenerContainer);
    }

    @Override
    public void onMessage(Message message, byte[] pattern) {
        String expiredKey = message.toString();
        System.err.println("Redis key:"+expiredKey+"过期回调**********************************************");
    }
}
